import * as Blockly from 'blockly/core';

const AV_HUE = "#2CAAD2";


//-------------------------new----------------------------------

export const voice_onoff_new = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendValueInput('key')
            .appendField("声音");
        this.setInputsInline(true);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("打开或者关闭声音运放使能端");
    }
}

//-新20210329------音频播放-------------------------------------------//
export const audio_play_new = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendDummyInput()
            .appendField("Audio 音频播放");
        this.appendValueInput('path')
            .appendField("路径")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(String);
        this.appendValueInput('volume')
            .appendField("音量(%)")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(Number);
        this.setInputsInline(false);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("音频播放");
    }
};

//-新20210329------音频录制-------------------------------------------//
export const audio_record_new = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendDummyInput()
            .appendField("Audio 音频录制");
        this.appendValueInput('path')
            .appendField("路径")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(String);
        this.appendValueInput('time')
            .appendField("时长(s)")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(Number);
        this.setInputsInline(false);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("音频录制");
    }
};

//-新20210329------视频播放-------------------------------------------//
export const video_play_new = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendDummyInput()
            .appendField("Video 视频播放");
        this.appendValueInput('path')
            .appendField("路径")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(String);
        this.appendValueInput('volume')
            .appendField("音量(%)")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(Number);
        this.setInputsInline(false);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("视频播放");
    }
};

//-新20210329------视频录制-------------------------------------------//
export const video_record_new = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendDummyInput()
            .appendField("Video 视频录制");
        this.appendValueInput('path')
            .appendField("路径")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(String);
        this.appendValueInput('time')
            .appendField("时长(s)")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(Number);
        this.setInputsInline(false);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("视频录制");
    }
};

//---------------TABIT 音频播放资源（I2S模式）---20230520--------------------
export const audio_tabit_play = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendDummyInput()
            .appendField("Audio 音频播放");
        this.appendValueInput('path')
            .appendField("路径")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(String);
        this.appendValueInput('volume')
            .appendField("音量(%)")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(Number);
        this.setInputsInline(false);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("音频播放");
    }
};

export const video_tabit_play = {
    init: function () {
        this.setColour(AV_HUE);
        this.appendDummyInput()
            .appendField("Video 视频播放");
        this.appendValueInput('path')
            .appendField("路径")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(String);
        this.appendValueInput('volume')
            .appendField("音量(%)")
            .setAlign(Blockly.ALIGN_RIGHT)
            .setCheck(Number);
        this.setInputsInline(false);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip("视频播放");
    }
};



